<extend name="Layout/ins_popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<div class="popup-frame">
		<div class="popup-header">
			<div class="pull-left">
				<h1>添加自定义字段</h1>
			</div>
			<div class="pull-right">
				<a class="btn btn_save" id="btn_save" >确定</a>
				<a class="btn btn-cancel" id="btn_close">关闭</a>
			</div>
		</div>
		<div class="popup-body">
			<div class="popup-body-scroll">
				<div class="popup-content">
					<form method='post' id="form_data" >
						<input type="hidden" name="controller" id="controller" value="{$controller}">
						<input type="hidden" name="row_type" id="row_type" value="{$row_type}">
						<input type="hidden" id="opmode" name="opmode" value="add">
						<div class="layui-form-item">
							<label class="layui-form-label" for="name">名称*：</label>
							<div class="layui-input-block col-16">
								<input class="layui-input" type="text" id="name" name="name" check="required" info="请输入名称" lay-verify="required">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="layout">控件布局：</label>
							<div class="layui-input-block col-12 x-select">
								<select name="layout" id="layout" check="required" info="请选择控件布局" class="layui-input col-12">
									<option value="">请选择 </option>
									<option value="1">一行两列</option>
									<option value="2">一行一列</option>
									<option value="3">占一整行</option>
									<option value="4">由控件控制</option>
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="type">控件类型*：</label>
							<div class="layui-input-block col-12 x-select">
								<select name="type" id="type" check="required" info="请选择控件类型" class="layui-input col-12">
									<option value="">请选择</option>
									<option value="popup">弹窗选择</option>
									<option value="add_file">文件上传</option>
									<option value="text">单行文本</option>
									<option value="date">日期 </option>
									<option value="datetime">日期+时间 </option>
									<option value="select">列表</option>
									<option value="link_select">联动列表</option>
									<option value="radio">单选</option>
									<option value="checkbox">多选 </option>
									<option value="textarea">多行文本 </option>
									<option value="editor">编辑器</option>
									<option value="simple">简易编辑器</option>
									<option value="help">帮助 </option>
									<option value="hr">分隔符</option>
									<option value="user_name">当前用户</option>
									<option value="dept_name">当前部门</option>
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="data">控件数据：</label>
							<div class="layui-input-block">
								<input  class="layui-input" type="text" id="data" name="data" >
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="config">设置：</label>
							<div class="layui-input-block">
								<input  class="layui-input" type="text" id="config" name="config" >
							</div>
						</div>
						<div class="layui-form-item =">
							<label class="col-xs-3 layui-form-label" for="sort">排序：</label>
							<div class="layui-input-block  col-10">
								<input class="layui-input" type="text" id="sort" name="sort" >
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="validate">验证：</label>
							<div class="layui-input-block col-10 x-select">
								<select name="validate" id="validate" class="layui-input">
									<option value="">请选择 <option value="required">必选 <option value="email">邮件 <option value="number">数字
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="col-xs-3 layui-form-label" for="msg">错误提示：</label>
							<div class="layui-input-block">
								<input  class="layui-input" type="text" id="msg" name="msg" >
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		layui.use(['global'], function() {
			var $ = layui.jquery;
			//

			$('#btn_save').on('click', function() {
				send_form('form_data', "{:U('save')}", '', function(ret) {
					if (ret.status) {
						layer.msg(ret.info, function() {
							parent.layer.msg(ret.info);
							parent.layer.close(index);
							parent.location.reload(true);
						});
					} else {
						parent.layer.msg(ret.info);
						return false;
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				parent.layer.close(index);
			});
		});

	</script>
</block>